package exception;

import java.awt.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.rmi.server.ExportException;
import java.sql.SQLException;

/**
 * @Classname: ThrowsDemo
 * @Author: bromide
 * @CreateTime: 2022/3/30--16:45
 * @Version: V1.0
 * @Description: 子类重写超类含有throws声明异常排除的方法时，对throws的重写规则
 */
public class ThrowsDemo {
    public void dosome() throws IOException, AWTException {
    }
}

class SubClass extends ThrowsDemo {
    //1.
//    public void dosome()throws IOException,AWTException{}

    //2.允许只抛出部分异常
//    public void dosome()throws IOException{}

    //3.允许不再抛出任何异常
//    public void dosome(){}

    //4.允许抛出超类方法抛出异常的子类异常
//    public void dosome()throws FileNotFoundException {}

    //5.不允许抛出额外异常：超类没有的，也没有继承关系的
//    public void dosome()throws SQLException{}

    //6.不允许抛出超类方法抛出异常的超类型异常
//    public void dosome()throws Exception{}

}
